package com.heima.feign.fallback;

import com.heima.article.dto.ArticleDto;
import com.heima.common.exception.CustomException;
import com.heima.feign.clients.ArticleClient;
import com.heima.common.enums.AppHttpCodeEnum;
import org.springframework.stereotype.Component;

/**
 * 这里做服务降级，抛出异常，防止服务堵塞造成雪崩
 */
@Component
public class ArticleClientFallBack implements ArticleClient {
    @Override
    public Long saveNews(ArticleDto dto) {
        throw new CustomException(AppHttpCodeEnum.SERVER_ERROR);
    }

    @Override
    public void saveArticleConfig(Long articleId) {
        throw new CustomException(AppHttpCodeEnum.SERVER_ERROR);
    }

    @Override
    public void saveContent(ArticleDto dto) {
        throw new CustomException(AppHttpCodeEnum.SERVER_ERROR);
    }

    /**
     * 自媒体审核通过后执行此方法，将文章详情利用模版引擎转为html，上传至minio
     *
     * @param dto
     */
    @Override
    public void upload2Minio(ArticleDto dto) {
        throw new CustomException(AppHttpCodeEnum.SERVER_ERROR);
    }
}
